From 4bc4d217f5bd6dee5bac3dfdb5360989b8852429 Mon Sep 17 00:00:00 2001 From: Magnus Manske Date: Tue, 16 Sep 2003 08:07:34 +0000 Subject: [PATCH] table markup with header --- includes/OutputPage.php | 44 +++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index eb4c969582..dd7252024a 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -604,40 +604,47 @@ function doTableStuff ( $t ) $t = explode ( "\n" , $t ) ; $td = array () ; # Is currently a td tag open? $tr = array () ; # Is currently a tr tag open? + $ltd = array () ; # Was it TD or TH? foreach ( $t AS $k => $x ) { $x = rtrim ( $x ) ; + $fc = substr ( $x , 0 , 1 ) ; if ( "{|" == substr ( $x , 0 , 2 ) ) { $t[$k] = "" ; array_push ( $td , false ) ; + array_push ( $ltd , "" ) ; array_push ( $tr , false ) ; } else if ( count ( $td ) == 0 ) { } # Don't do any of the following else if ( "|}" == substr ( $x , 0 , 2 ) ) { $z = "
\n" ; + $l = array_pop ( $ltd ) ; if ( array_pop ( $tr ) ) $z = "" . $z ; - if ( array_pop ( $td ) ) $z = "" . $z ; + if ( array_pop ( $td ) ) $z = "" . $z ; $t[$k] = $z ; } else if ( "|_" == substr ( $x , 0 , 2 ) ) # Caption -{ -$z = trim ( substr ( $x , 2 ) ) ; -$t[$k] = "{$z}{$y[1]}" ; + if ( count ( $y ) == 1 ) $y = "{$z}<{$l}>{$y[0]}" ; + else $y = $y = "{$z}<{$l} {$y[0]}>{$y[1]}" ; $t[$k] .= $y ; array_push ( $td , true ) ; } } } -# Closing open td, tr && table -while ( count ( $td ) > 0 ) -{ -if ( array_pop ( $td ) ) $t[] = "" ; -if ( array_pop ( $tr ) ) $t[] = "" ; -$t[] = "" ; -} - - $t = implode ( "\n" , $t ) ; - return $t ; -} # Well, OK, it's actually about 14 passes. But since all the # hard lifting is done inside PHP's regex code, it probably -- 2.20.1